package com.example.voucher.biz.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.voucher.biz.EasMappingBiz;
import com.example.voucher.entity.MappingItem;
import com.example.voucher.mapper.MappingItemMapper;

@Component
public class EasMappingBizImpl extends ServiceImpl<MappingItemMapper, MappingItem> implements EasMappingBiz {

    @Autowired
    private MappingItemMapper mappingItemMapper;

    @Override
    @Cacheable(key = "#tenantCode", cacheNames = "easMapping")
    public List<MappingItem> listMappingItemByTenantCode(String tenantCode) {
        LambdaQueryWrapper<MappingItem> queryWrapper = Wrappers.<MappingItem>lambdaQuery();
        queryWrapper.eq(MappingItem::getTenantCode, tenantCode);
        return mappingItemMapper.selectList(queryWrapper);
    }

}
